<?php require_once('../g-config/konek.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO data_user (id, nama_user, pass, email, template, nama_site, bio_site) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['id'], "int"),
                       GetSQLValueString($_POST['nama_user'], "text"),
                       GetSQLValueString(md5($_POST['pass']), "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['template'], "text"),
                       GetSQLValueString($_POST['nama_site'], "text"),
                       GetSQLValueString($_POST['bio_site'], "text"));

  mysql_select_db($database_konek, $konek);
  $Result1 = mysql_query($insertSQL, $konek) or die(mysql_error());

  $insertGoTo = "../";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert Data Admin</title>
<link href='../g-konten/fm/icon.png' rel='shortcut icon'/>

    <!-- Bootstrap -->
    <link href="../g-template/default/css/bootstrap.min.css" rel="stylesheet">
    <link href="../g-template/default/css/default.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../g-template/default/css/default.css" />
    <link rel="stylesheet" type="text/css" href="../g-template/default/css/menu.css" />
	<link rel="stylesheet" type="text/css" href="../g-template/default/css/component.css" />
	<script src="../g-template/default/js/modernizr.custom.js"></script>
	<!-- Add jQuery library -->
	<script type="text/javascript" src="../g-template/default/fancy/lib/jquery-1.10.1.min.js"></script>


	<!-- Add fancyBox main JS and CSS files -->
	<script type="text/javascript" src="../g-template/default/fancy/source/jquery.fancybox.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="../g-template/default/fancy/source/jquery.fancybox.css?v=2.1.5" media="screen" />


	<!-- Add Thumbnail helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="../g-template/default/fancy/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
	<script type="text/javascript" src="../g-template/default/fancy/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

	<script type="text/javascript">
	var coy = jQuery.noConflict();
		coy(document).ready(function() {
			
			coy('.fancybox-thumbs').fancybox({
				prevEffect : 'none',
				nextEffect : 'none',

				closeBtn  : false,
				arrows    : true,
				nextClick : true,

				helpers : {
					thumbs : {
						width  : 50,
						height : 50
					}
				}
			});

			

		});
	</script>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->


</head>
<body style="background:#FFF">
<div class="container">
<div align="center" style="margin:20px;">
<img src="../g-konten/fm/logo.png" class="img-rounded">
<h1>Configurasi Data Admin</h1></div>
<form action="" method="post" class="form-horizontal" role="form">
<div class="form-group">
    <label class="col-sm-2 control-label" >Username </label>
    <div class="col-sm-10">
    <input type="text" name="nama_user" class="form-control col-lg-5" placeholder=" ... ">
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label" for="inputPassword3" >Password </label>
    <div class="col-sm-10">
    <input type="password" name="pass" class="form-control col-lg-5" id="inputPassword3" placeholder=" ... ">
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label" for="inputEmail3" >E-mail </label>
    <div class="col-sm-10">
    <input type="text" name="email" class="form-control col-lg-5" id="inputEmail3" placeholder=" ... ">
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label" >Nama Website </label>
    <div class="col-sm-10">
    <input type="text" name="nama_site" class="form-control col-lg-5" placeholder=" ... ">
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label" >Tentang Website Anda </label>
    <div class="col-sm-10">
      <textarea name="bio_site" class="form-control col-lg-5" rows="6" placeholder=" ... "></textarea>
    </div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type='submit' value='Submit' class="btn btn-default" >
</div>
</div>
<input type="hidden" name="template" value="default" />
<input type="hidden" name="id" value="1" />
<input type="hidden" name="MM_insert" value="form1" />

</form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
		<script src="../g-template/default/js/cbpHorizontalMenu.min.js"></script>
		<script>
			$(function() {
				cbpHorizontalMenu.init();
			});
		</script>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="../g-template/default/js/bootstrap.min.js"></script>

</body>
</html>